package net.funwoo.pandago;

import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * Created by Bob Peng on 2015/5/6.
 */
public class AppConfig {

    public static final String URL_ROOT = "http://121.40.97.89:8181/";
    public static final String SMS_APP_KEY = "73a1a768ea10";
    public static final String SMS_APP_SECRET = "8303bc4a9c2f90aba4912f363a4f4696";

    public static final String KEY_USER_ID = "userId";

    public static final boolean TRANSLUCENT_BAR_ENABLED = true;

    public static SharedPreferences getPref() {
        return PreferenceManager.getDefaultSharedPreferences(AppApplication.getInstance());
    }

    public static SharedPreferences.Editor getEditor() {
        return getPref().edit();
    }

    public static void putString(String key, String value) {
        getPref().edit().putString(key, value).apply();
    }

    public static void putInt(String key, int value) {
        getPref().edit().putInt(key, value).apply();
    }

    public static void putBoolean(String key, boolean value) {
        getPref().edit().putBoolean(key, value).apply();
    }

    public static String getString(String key, String defValue) {
        return getPref().getString(key, defValue);
    }

    public static int getInt(String key, int defValue) {
        return getPref().getInt(key, defValue);
    }

    public static boolean getBoolean(String key, boolean defValue) {
        return getPref().getBoolean(key, defValue);
    }
}
